package com.yehangtech.designpattern.结构型_组合模式;

import com.yehangtech.designpattern.结构型_组合模式.service.Component;
import com.yehangtech.designpattern.结构型_组合模式.service.Composite;
import com.yehangtech.designpattern.结构型_组合模式.service.Leaf;

public class Main {
    public static void main(String[] args) {
        // todo 解决树状结构的问题
        Component a = new Composite("服装");
        Component b1 = new Composite("男装");
        Component b2 = new Composite("女装");
        Component c1 = new Leaf("旗袍");
        Component c2 = new Leaf("高跟鞋");
        Component c3 = new Leaf("皮鞋");
        Component c4 = new Leaf("西装");

        a.addChild(b1);
        a.addChild(b2);
        b1.addChild(c3);
        b1.addChild(c4);
        b2.addChild(c1);
        b2.addChild(c2);
        System.out.println(a.printSelf());
    }
}
